

// layout
import Fotter from "@/layout/fotter/index.vue";
import Header from "@/layout/header/index.vue";

//#region 自动导入模块路由
const files = require.context("./modules", false, /\.js$/);
const modules = [];

files.keys().forEach((key) => {
  modules.push(files(key).default || files(key));
});
console.log(modules)
//#endregion

const routes = [
  {
    path: "/login_dl",
    name: "loginDL",
    meta: {
      title: "代理商登录",
      isOpen: true,
      index:1
    },
    component: () => import("@/views/login/login_dl.vue"),
  },
  {
    path: "/school_list_dl",
    name: "schoolListDl",
    meta: {
      title: "上课学校列表",
      isOpen: true,
      index:1
    },
    component: () => import("@/views/school/school_list_dl.vue"),
  },
  {
    path: "/login",
    name: "login",
    meta: {
      title: "登录",
      isOpen: true,
      index:0
    },
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: "/test",
    name: "test",
    meta: {
      title: "登录",
      isOpen: true,
    },
    component: () => import("@/views/test/jssdk.vue"),
  },
  {
    path: "/forget_password",
    name: "forgetPassword",
    meta: {
      title: "忘记密码",
      isOpen: true,
      index:1
    },
    component: () => import("@/views/forgetPassword/index.vue"),
  },
  {
    path: "/course_buy",
    name: "courseBuy",
    meta: {
      title: "购买体质改善课程",
      isOpen: true,
    },
    component: () => import("@/views/course_set/course_buy.vue"),
  },
  {
    path: "/school_set",
    name: "schoolSet",
    meta: {
      title: "设置学校",
      isOpen: true,
    },
    component: () => import("@/views/course_set/school_set.vue"),
  },
  {
    path: "/",
    name: "fotterMain",
    redirect: "/select_class",
    component: Fotter,
    children: [
      {
        path: "select_class",
        name: "selectClass",
        meta: {
          title: "班级选择",
          isOpen: true,
          index:11
        },
        component: () => import("@/views/course/select_class.vue"),
      },
      {
        path: "person_center",
        name: "personCenter",
        meta: {
          title: "个人中心",
          index:13
        },
        component: () => import("@/views/personCenter/index.vue"),
      },
      {
        path: "class_manage",
        name: "classManage",
        meta: {
          title: "班级管理",
          index:13
        },
        component: () => import("@/views/class/index.vue"),
      },
      {
        path: "order_list",
        name: "orderList",
        meta: {
          title: "订单列表",
          index:13
        },
        component: () => import("@/views/personCenter/order_list.vue"),
      },
      {
        path: "order_detail",
        name: "orderDetail",
        meta: {
          title: "订单详情",
          index:131
        },
        component: () => import("@/views/personCenter/order_detail.vue"),
      }
    ]
  },
  {
    path: "/",
    name: "headerMain",
    redirect: "/course",
    component: Header,
    children: [...modules],
  },
  {
    path: "/select_course",
    name: "selectCourse",
    meta: {
      title: "课程选择",
      index:11
    },
    component: () => import("@/views/course/select_course.vue"),
  },
  {
    path: "/select_try_course",
    name: "selectTryCourse",
    meta: {
      title: "体验课程选择",
      isOpen: true,
      index:1234
    },
    component: () => import("@/views/course/select_try_course.vue"),
  },
  {
    path: "/select_try_class",
    name: "selectTryClass",
    meta: {
      title: "选择班级",
      isOpen: true
    },
    component: () => import("@/views/class/select_try_class.vue"),
  },
  {
    path: "/course_detail",
    name: "courseDetail",
    meta: {
      title: "课程详情",
      isOpen: true,
      index:11
    },
    component: () => import("@/views/course/course_detail.vue"),
  },
  {
    path: "/redirect",
    name: "redirect",
    meta: {
      title: "Redirect demo",
      hideHeader: true,
      isOpen: true,
    },
    component: () => import("@/views/redirect/index.vue"),
  },
];

export default routes;
